//
//  YYTool.h
//  AFNetworking
//
//  Created by 余意 on 2018/7/3.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface YYTool : NSObject

+ (instancetype)shareInstance;

#pragma mark - 新建NSDateFormatter是浪费资源的 所以用单例
+ (NSDateFormatter *)shareDateFormatter;

#pragma mark - 随机生成数字串
+ (NSString *)randomNumberStringWithLength:(NSInteger)length;

#pragma mark - 随机生成字符串
+ (NSString *)randomCharacterStringWithLength:(NSInteger)length;

#pragma mark - 随机生成数字字符串
+ (NSString *)randomStringWithLength:(NSInteger)length;

#pragma mark - 给出格式，把时间转换成字符串
+ (NSString *)dateStringWithDate:(NSDate *)date WithFormart:(NSString *)formart;

#pragma mark - 给出格式，把字符串转换成时间
+ (NSDate *)dateWithString:(NSString *)string WithFormart:(NSString *)formart;

#pragma mark - 获取当前时间格式(yyyyMMddHHmmss)
+ (NSString *)nowTimeString;

#pragma mark - 获取当前时间戳(毫秒级)
+ (NSString *)nowTimeStamp;

#pragma mark - 获取UUID 32个 16进制数字 每次都不一样
+ (NSString *)UUID;

#pragma mark - 过滤字符串里面的HTML
+ (NSString *)filterHTMLWithString:(NSString *)string;


#pragma mark - 判断字符串为空
+ (BOOL)isNullWithString:(NSString *)string;

#pragma mark - 判断数组是否为空
+ (BOOL)isNullWithArray:(NSArray *)array;

#pragma mark - 判断字典是否为空
+ (BOOL)isNullWithDictionary:(NSDictionary *)dict;


#pragma mark - JSONString转化为dict
+ (NSDictionary *)dictionaryWithJSONString:(NSString *)JSONString;

#pragma mark - JSONStrng转化为array
+ (NSArray *)arrayWithJSONString:(NSString *)JSONString;

#pragma mark - 拨打电话
+ (void)phoneWithMobile:(NSString *)mobile;

#pragma mark - 修正iPhone拍照图片的方向
+ (UIImage *)fixOrientationWithImage:(UIImage *)img;

#pragma mark - 颜色和frame生成图片
+ (UIImage *)imageWithColor:(UIColor *)color WithSize:(CGSize)size;



#pragma mark - 根据文本、字号、高度来获取宽度
+ (CGFloat)getWidthWithString:(NSString *)string
                     WithFont:(UIFont *)font
                   WithHeight:(CGFloat)height;

#pragma mark - 根据文本、字号、宽度来获取高度
+ (CGFloat)getHeightWithString:(NSString *)string
                      WithFont:(UIFont *)font
                     WithWidth:(CGFloat)width;

@end
